package cn.kgc.entity;

import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * User类是SpringSecurity的用户类
 * 将自己的Users类包装成SpringSecurity的User类
 */
@Setter
@Getter
public class CustomerUser extends User {
    /**
     * 自己的用户信息
     */
    private Users users;

    public CustomerUser(Users users, Collection<? extends GrantedAuthority> authorities) {
        super(users.getUserName(), "{bcrypt}" + users.getUserPwd(), authorities);
        this.users = users;
    }
}
